import request from './request';

/* eslint-disable */


// 获取资源详情

export const resourceDetail = uuid => request({
  method: 'get',
  url: `/key/${uuid}/`,
});


// 发送验证码
export const loginPhone = data => request({
  method: 'post',
  url: '/member/login/',
  data,
});

// logout
export const logout = data => request({
  method: 'post',
  url: '/member/logout/',
  data,
});

// 验证码登录
export const getActivity = params => request({
  method: 'get',
  url: '/getActivity',
  params,
});


// 判断是否登录失效
export const loginStatus = () => request({
  method: 'get',
  url: '/member/is_login',
});

// 获取验证码
export const getCode = data => request({
  method: 'post',
  url: '/member/send_sms',
  data,
});


// 获取用户信息
export const getUserInfo = () => request({
  method: 'get',
  url: '/member',
});


// // 领取答题的喜加一
// export const getNewReward = uri => request({
//   method: 'post',
//   headers: {'Content-Type': 'application/x-www-form-urlencoded'},
//   url: '/member/get_new_reward',
// });


// 抽奖
export const raffle = data => request({
  method: 'post',
  url: '/raffle/raffle',
  data,
});

// 获取抽奖包
export const getRaffles = data => request({
  method: 'get',
  url: '/raffle',
  data,
});


// 获取某个抽奖包的详情
export const getPackageDetail = name => request({
  method: 'get',
  url: `/raffle/${name}`,
});

// 获取抽到的游戏的详情
export const getRaffleDetail = url => request({
  method: 'get',
  url,
});

// 获取当前用户信息
export const getMemberDetail = url => request({
  method: 'get',
  url: '/member',
});

// 充值接口
export const recharge = data => request({
  method: 'post',
  url: '/recharge/recharge',
  data,
});

// 支付宝支付接口改造了
export const apipay = data => request({
  url: '/alipay/get_ali_url/',
  method: 'post',
  data,
});

// 获取自己所有key的接口
export const getMyKey = data => request({
  url: `/key?page=${data}`,
  method: 'get'
});


// 回收key
export const recycle = uri => request({
  method: 'post',
  url: '/key/recycle',
  data: {
    resource_uri: uri,
  }
});

// 打开key
export const openKey = uri => request({
  method: 'post',
  url: "/key/open_key",
  data: {
    resource_uri: uri,
  }
});

// 判断邀请码是否能用
export const invite_code = code => request({
  method: 'post',
  url: "/member/submit_pull_new_code",
  data: {
    code
  }
});


// 提交已经成功发送了奖品了
export const getNewReward = answer => request({
  method: 'post',
  url: "/member/get_new_reward",
  data: {
    answer
  }
});


// 获取gitest的验证码初始化
export const  get_captcha_init = () => request({
  method: 'get',
  url: "/member/get_captcha",
});



// 获取gitest的验证码初始化
export const  validate_captcha = params => request({
  method: 'post',
  url: "/member/validate",
  data:{
    ...params
  }
});


// 发送腾讯验证码给后端
export const  tx_validate = params => request({
  method: 'post',
  url: "/member/tx_validate",
  data:{
    ...params
  }
});


// 轮询订单是否已经充值成功了
export const getRechargeStatus = orderId => request({
  url: `/recharge/${orderId}`,
  method: 'get'
});

// 轮询支付宝订单
export const getAlipayStatus = orderId => request({
  url: `/alipay/${orderId}`,
  method: 'get'
});

// 获取挂卡机器人
export const getAllBot = () => request({
  url: '/steam_bot/',
  method: 'get'
});

// 获取机器人状态
export const getBotStatus = botId => request({
  url: `/steam_bot/${botId}`,
  method: 'get'
});

// 新建挂卡机器人
export const  createBot = data => request({
  method: 'post',
  url: "/steam_bot/",
  data
});

// 启动挂卡机器人
export const  startBot = botId => request({
  method: 'post',
  url: `/steam_bot/${botId}/start`
});

// 输入各种需要的码(比如手机令牌或邮箱验证码)
export const  robotInput = (data, botId) => request({
  method: 'post',
  url: `/steam_bot/${botId}/input`,
  data
});

// 输入各种需要的码(比如手机令牌或邮箱验证码)
export const  robotStop = botId => request({
  method: 'post',
  url: `/steam_bot/${botId}/stop`
});